package jge.renderer.tests.opengl;

import jge.datatypes.RESULT;
import jge.renderer.JGERenderDevice;
import jge.renderer.JGERenderer;
import jge.renderer.JGERenderer.RENDERAPI;
import jge.window.JGEWindow;
import jge.window.JGEWindowFactory;
import jge.window.JGEWindowFactory.WINDOWAPI;
import junit.framework.Assert;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class OpenGLTests {
	
	JGERenderer renderer;
	JGERenderDevice device;

	@Before
	public void setUp() throws Exception {
		renderer = new JGERenderer();
	}

	@After
	public void tearDown() throws Exception {
		
	}

	@Test
	public void testCreateDevice() {
		Assert.assertEquals(RESULT.OK, renderer.CreateDevice(RENDERAPI.OPENGL));
	}
	
	@Test
	public void testGetDevice() {
		renderer.CreateDevice(RENDERAPI.OPENGL);
		device = renderer.GetDevice();
		Assert.assertNotNull(device);
	}
	
	@Test
	public void testInitDevice() {
		// Create Window
		JGEWindow window = JGEWindowFactory.createWindow(WINDOWAPI.AWT, "Test Render Window", 800, 600, false);
		
		renderer.CreateDevice(RENDERAPI.OPENGL);
		device = renderer.GetDevice();
		Assert.assertEquals(RESULT.OK, device.Init(window));
	}

}
